const express=require('express');
const router=express.Router();

const bodyParser=require('body-Parser');
router.use(bodyParser.urlencoded({extended:false}));

const fs=require('fs');

router.get('/abc',(req,res)=>{
    let id=req.query.id;
    res.sendFile(__dirname+'/data/'+id+'.json')
});
router.post('/abc',(req,res)=>{
    let data=req.body.getobj;
    fs.writeFile(__dirname+'/data/stu.json',data,()=>{
        res.send('成功');
    })
})
module.exports=router;